﻿using System.Linq.Expressions;
using Basic.FormCollect.Model;
using Basic.FormModel.DB;
using Basic.FormModel.Model;
using Basic.FormRemoteModel.Form.Model;
using Basic.FormRemoteModel.QueryColumn.Model;

namespace Basic.FormCollect
{
    public interface IQueryColumnCollect
    {
        Dictionary<long, string> GetColName ( long[] ids );
        Dictionary<long, PhyTableCol> GetCols ( long[] tableId );
        Dictionary<long, PhyTableCol> GetColumns ( long[] ids );
        DBPhysicalQueryColumn Get ( long id );
        void Delete ( DBPhysicalQueryColumn sour );
        bool Set ( DBPhysicalQueryColumn sour, QueryColumnSet set );
        ColumnSort[] GetSorts ( long tableId, long groupId );
        void SetSort ( ColumnSort sour, ColumnSort to );
        void SetSort ( KeyValuePair<long, int>[] sort );
        long Add ( QueryColumnAdd add );
        void Clear ( long id );
        Result[] GetsByFormId<Result> ( long formId, bool isSystem = false ) where Result : class, new();
        Result[] GetsByTableId<Result> ( long tableId, bool? isHidden ) where Result : class, new();
        Result[] GetsByFormId<Result> ( long formId, FormGetParam param ) where Result : class, new();
        void ClearByTableId ( long tableId );
        void ClearByGroupId ( long id );
        Result[] Gets<Result> ( long[] ids ) where Result : class, new();
        Result Get<Result> ( long columnId ) where Result : class, new();
        Dictionary<long, string> GetLabels ( long[] ids );

        Result[] GetsByTableId<Result> ( long tableId, FormGetParam param, Expression<Func<DBPhysicalQueryColumn, Result>> selector ) where Result : class, new();
        long[] Filter ( long[] ids, FormGetParam param );
        Result[] Filter<Result> ( long[] ids, FormGetParam param ) where Result : class, new();
    }
}